import 'package:flutter/material.dart';

class WidgetsPage extends StatefulWidget {
  const WidgetsPage({super.key});

  @override
  State<WidgetsPage> createState() => _WidgetsPageState();
}

class _WidgetsPageState extends State<WidgetsPage> {
  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: Column(
        children: [
          Container(
            width: 300,
            height: 300,
            color: Colors.grey[200],
            child: const FittedBox(
              fit: BoxFit.contain,
              child: Text(
                  "FittedBox 是一个很有用的布局组件,它可以帮助我们控制子组件的大小和位置,使其能够适应父容器的大小。"),
            ),
          ),
          ConstrainedBox(
            constraints: const BoxConstraints(
              minWidth: 100.0,
              minHeight: 100.0,
              maxWidth: 300.0,
              maxHeight: 300.0,
            ),
            child: Container(
              color: Colors.blue,
            ),
          ),
          InteractiveViewer(
            boundaryMargin: EdgeInsets.all(20.0),
            minScale: 0.1,
            maxScale: 4.0,
            child: Image.network(
                'https://ducafecat.oss-cn-beijing.aliyuncs.com/podcast/2024/07/1754ca341970848fa7d943285d18a5b3.png'),
          ),
        ],
      ),
    );
  }
}
